<!DOCTYPE html>
<html>
    <head>
        <style>
            section {
                border: 1px solid blue;
                padding: 5px;
                margin: 5px;
                display: inline-block;
                width: 150px;
                height: 75px;
                vertical-align: bottom;
            }
            section.nosel::selection {
                background-color: transparent;
                color: black;
            }
        </style>
    </head>

    <body>
        <section>
            Everything in this box should be selected and the text
            should be visible.
        </section>
        <section class="nosel">
            Nothing in this box should be selected and the text
            should be visible.
        </section>
        <section>
            Everything in this box should be selected and the text
            should be visible.
        </section>

        <script>
            var selection = window.getSelection();
            var range = document.createRange();
            range.selectNodeContents(document.body);
            selection.removeAllRanges();
            selection.addRange(range);
        </script>
    </body>
</html>
